﻿<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Financial Tracking</title>
<script src="${pageContext.request.contextPath}/js/jquery.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/jquery-ui.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/global.js" type="text/javascript"></script>

<link rel="stylesheet" href="${pageContext.request.contextPath}/css/jquery-ui.css" type="text/css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/styles.css" type="text/css" />

<script>
	var hospitalCode = '';
	var DEFAULT_SCROLL = 34500;
	var loadingScroll = DEFAULT_SCROLL;
	var start = 0;
	var end = 1000;
	var cntAll = 0;
	var totalSalaryAmount = 0;
	var totalDischarge = 0;
	var totalChargeRule = 0;
	var totalCompensation = 0;
	
	var totalOrfHMain = 0;
	var totalOrfNHSO = 0;
	
	var totalSumHC = 0;
	var totalSumAE = 0;
	var totalSumINST = 0;
	var totalSumIP = 0;
	var totalSumDMIS = 0;
	var totalSumOP = 0;
	var totalSumPA = 0;
	var totalSumOT = 0;
	var totalSumDRUG = 0;
	
	var totalOldTotal = 0;
	var totalOldSumHC = 0;
	var totalOldSumAE = 0;
	var totalOldSumINST = 0;
	var totalOldSumIP = 0;
	var totalOldSumDMIS = 0;
	var totalOldSumOP = 0;
	var totalOldSumPA = 0;
	var totalOldSumOT = 0;
	var totalOldSumDRUG = 0;
	var totalOldAmount = 0;
	
	var totalNewSumHC = 0;
	var totalNewSumAE = 0;
	var totalNewSumINST = 0;
	var totalNewSumIP = 0;
	var totalNewSumDMIS = 0;
	var totalNewSumOP = 0;
	var totalNewSumPA = 0;
	var totalNewSumOT = 0;
	var totalNewSumDRUG = 0;
	var totalNewDischarge = 0;
	var totalNewCompensation = 0;
	
	var totalPay = 0;
	var totalReturn = 0;
	
	var countStatusA = 0;
	var rowspan_thead1 = "2746px";
	var rowspan_thead2 = "5880px";
	$(function() {
		$('.loader').fadeOut('slow');
		$('head').append('<link rel="icon" type="image/icon" href="${pageContext.request.contextPath}/images/mini-icon.ico">');
		var DEFAULT_DATE = '01 ' + thai_months[4] + ' 2013';
		var START_DATE = '01 ' + thai_months[9];
		var END_DATE = '30 ' + thai_months[8];
		var presentDate = new Date();
		var PRESENT_YEAR = presentDate.getFullYear() + 543;		
		$("#fromFiscalYear, #toFiscalYear").datepicker({
			buttonImage: "${pageContext.request.contextPath}/images/calendar.gif"
		});
		
		hideTable();
		$('#detailData').hide();
		
		$("#show_table").click(function(){

			$("#tbHeaderData").attr("width",rowspan_thead2);
			$("#tbBodyData").attr("width",rowspan_thead2);
			
			$("#tbValueData").css("height","395px");
			
			$("#thead1").hide();
			$("#thead2").show();
			
			$(".hidden-table").show();
			
			$("#show_table").hide();
			$("#hide_table").show();
		});
		
		$("#hide_table").click(function(){
			hideTable();			
		});
	
		$.changeFiscalYear = function(year){
			var val = year;
			var valMinDate = '';
			var valMaxDate = '';
			var minDate =  (val-543) - 1;
			var maxDate = (val-543);
			if(minDate === 2012){
				minDate = DEFAULT_DATE;
				valMinDate = '01 ' + thai_months[4] + ' 2556';
			}else{
				minDate = START_DATE + ' ' +minDate;
				valMinDate =  START_DATE + ' ' + (val-1);
			}
			maxDate = END_DATE + ' ' + maxDate;
			valMaxDate = END_DATE + ' ' + val;
			$("#fromFiscalYear").datepicker('option', 'minDate', minDate);
			$("#fromFiscalYear").datepicker('option', 'maxDate', maxDate);
			$("#toFiscalYear").datepicker('option', 'minDate', minDate);
			$("#toFiscalYear").datepicker('option', 'maxDate', maxDate);
			$("#fromFiscalYear").val(valMinDate);
			$("#toFiscalYear").val(valMaxDate);
		};
		$("#cbxHospital").combobox();
		var opts = "";
		for(var i=2556; i<=PRESENT_YEAR; i++){
			if(i<PRESENT_YEAR){
				opts += '<option value="' + i + '">' + i + '</option>';
			}else{
				opts += '<option value="' + i + '" selected>' + i + '</option>';
			}
		}
		$("#cbxFiscalYear").html(opts);
		$.changeFiscalYear(PRESENT_YEAR);
		$("#cbxFiscalYear").change(function(){
			$.changeFiscalYear($(this).val());
		});
		
		$('#searchBy').change(function(){
			var val = $(this).val();
			if(val === ''){
				$('#searchGroupHospital').show();
				$('#searchByHCode').hide();
				$.ajax({
		            url : '${pageContext.request.contextPath}/master/getZone',
		            type: "POST",
		            success : function(data) {
						if(data.success){
							if(data.code === "0000"){
								datas = data.datas;
								var option = "";
								option += "<option value=''>------ กรุณาเลือก ------</option>";
								$.each(data.datas, function(key, value) {
									option += "<option value='"+value.zoneId+"'>" + value.zoneName + "</option>";
								});
								$("#cbxZone").html("");
								$("#cbxZone").html(option);
								$("#cbxHospital").html('');
								$(".custom-combobox-input").val("------ กรุณาเลือก ------");
								$("#cbxProvince").html("<option value=''>------ กรุณาเลือก ------</option>");
							}
						}else{
		            		$.alert("ERROR" + data.code, data.msg);
						}
		            }
		        });
			}else if(val === 'hcodeSelect'){
				$('#searchGroupHospital').hide();
				$('#searchByHCode').show();
			}
		});
		
		$("#cbxZone").change(function(){
			$.ajax({
	            url : '${pageContext.request.contextPath}/master/getProvince',
	            type: "POST",
		       	data: {zoneId: $(this).val()},
	            success : function(data) {
					if(data.success){
						if(data.code === "0000"){
							datas = data.datas;
							var option = "";
							option += "<option value=''>------ กรุณาเลือก ------</option>";
							$.each(data.datas, function(key, value) {
								option += "<option value='"+value.provinceCode+"'>" + value.provinceName + "</option>";
							});
							$("#cbxProvince").html("");
							$("#cbxProvince").html(option);		
							$("#cbxHospital").html('');
							$(".custom-combobox-input").val("------ กรุณาเลือก ------");						
						}
					}else{
	            		$.alert("ERROR" + data.code, data.msg);
					}
	            }
	        });
		});
		$("#cbxProvince").change(function(){
			$.ajax({
	            url : '${pageContext.request.contextPath}/master/getHospital',
	            type: "POST",
	            data: {zoneId: $("#cbxZone").val(), provinceId: $(this).val()},
	            success : function(data) {
					if(data.success){
						if(data.code === "0000"){
							datas = data.datas;
							var option = "";
							var selected = "";
							$.each(data.datas, function(key, value) {
								var len = value.hospitalCode.length;
								var hospitalCode = value.hospitalCode.substring(len -5, len);
								option += "<option value='" + hospitalCode + "'>" + hospitalCode + " - " + value.hospitalName + "</option>";
							});
							$("#cbxHospital").html("");
							$("#cbxHospital").html(option);
							$("#cbxHospital").combobox();
							$(".custom-combobox-input").focusin(function(){
								$(this).val("");
							});
							
							$(".custom-combobox-input").focusout(function(){
								var text = $("#cbxHospital option:selected" ).text();
								$(this).val(text);
							});
						}
					}else{
	            		$.alert("ERROR" + data.code, data.msg);
					}
	            }
	        });
		});
		
		
		$('#exportExcel').click(function(){
			window.open('${pageContext.request.contextPath}/summaryrep/' + hospitalCode);
		});
		
		$('#tbValueData').scroll( function() {
			var fromtop = $(this).scrollTop();

			if (fromtop > loadingScroll) {
				loadingScroll += DEFAULT_SCROLL;
				start += 1000;
				end += 1000;
				var selectSearch = $("#searchBy").val();
				var fromDate = $('#fromFiscalYear').val();
				if(fromDate === ''){
					$.alert('', 'โปรดระบุช่วงวันที่');
					return;
				}
				var toDate = $('#toFiscalYear').val();
				if(toDate === ''){
					$.alert('', 'โปรดระบุช่วงวันที่');
					return;
				}
				
				fromDate = formatStrDate(fromDate);
				toDate = formatStrDate(toDate);
				if(!checkDate(fromDate, toDate)){
					return;
				}
				var hcode = '';
				if(selectSearch === ''){
					hcode = $(".custom-combobox-input").val();
					var tmps = hcode.split("-");
					hcode = $.trim(tmps[0]);
					if(hcode === ''){
						$.alert('', 'โปรดระบุรหัสหน่วยบริการ');
						return;
					}
				}else{
					var valHCode = $(".txtHospitalCode").val();
					if(valHCode === ''){
						$.alert('', 'โปรดระบุรหัสหน่วยบริการ');
						return;
					}
					//clearData();
					var tmps = valHCode.split("-");
					hcode = $.trim(tmps[0]);
				}
				
				if(!checkDate(fromDate, toDate)){
					$("#fromDate").val(formatDate(lastDate));
					return;
				}
				$.ajax({
					url: '${pageContext.request.contextPath}/summaryrep/getByHCode',
					data: {start: start, end: end, hCode: hcode, fromDate: fromDate, toDate: toDate, authType: $('#cbxSelectAuthType').val()},
					type: 'POST',
					success : function(data) {
						if(data.success){
							var arrays = data.datas;
							appendHTMLData(arrays, $("#tbBodyData tbody").html(), false);
						}else{
							$.alert('', 'ไม่มีข้อมูล');
							$("#tbBodyData tbody").html('<tr><td colspan="30" class="required">ไม่มีข้อมูล</td></tr>');
						}
					}
				});
			}
		});
		
		$("#btnSearch").click(function(){
			var selectSearch = $("#searchBy").val();
			var fromDate = $('#fromFiscalYear').val();
			if(fromDate === ''){
				$.alert('', 'โปรดระบุช่วงวันที่');
				return;
			}
			var toDate = $('#toFiscalYear').val();
			if(toDate === ''){
				$.alert('', 'โปรดระบุช่วงวันที่');
				return;
			}
			
			fromDate = formatStrDate(fromDate);
			toDate = formatStrDate(toDate);
			if(!checkDate(fromDate, toDate)){
				return;
			}
			var hcode = '';
			if(selectSearch === ''){
				hcode = $(".custom-combobox-input").val();
				var tmps = hcode.split("-");
				hcode = $.trim(tmps[0]);
				if(hcode === ''){
					$.alert('', 'โปรดระบุรหัสหน่วยบริการ');
					return;
				}
			}else{
				var valHCode = $(".txtHospitalCode").val();
				if(valHCode === ''){
					$.alert('', 'โปรดระบุรหัสหน่วยบริการ');
					return;
				}
				clearData();
				var tmps = valHCode.split("-");
				hcode = $.trim(tmps[0]);
			}
			
			if(!checkDate(fromDate, toDate)){
				$("#fromDate").val(formatDate(lastDate));
				return;
			}
			$.ajax({
				url: '${pageContext.request.contextPath}/summaryrep/getByHCode',
				data: {start: start, end: end, hCode: hcode, fromDate: fromDate, toDate: toDate, authType: $('#cbxSelectAuthType').val()},
				type: 'POST',
				success : function(data) {
					if(data.success){
						var arrays = data.datas;
						$("#tbBodyData tbody").html('');
						appendHTMLData(arrays, $("#tbBodyData tbody").html(), false);
					}else{
						$.alert('', 'ไม่มีข้อมูล');
						$("#tbBodyData tbody").html('<tr><td colspan="30" class="required">ไม่มีข้อมูล</td></tr>');
					}
				}
			});
		});
	});
	
	function hideTable(){
		$("#tbHeaderData").attr("width",rowspan_thead1);
		$("#tbBodyData").attr("width",rowspan_thead1);
		
		$("#tbValueData").css("height","395px");
		
		$("#thead1").show();
		$("#thead2").hide();
		
		$(".hidden-table").hide();
		
		$("#show_table").show();
		$("#hide_table").hide();
	}
	
	function appendHTMLData(arrays, tb, fromLoad){
		$('#detailData').hide();
		hideTable();
		var cntAllPerson = arrays.countAllPerson === null ? 0 : arrays.countAllPerson;
		cntAll = cntAllPerson;
		var cntPersonAppeal = arrays.countAppeal === null ? 0 : arrays.countAppeal;
		var cntPersonNotPass = arrays.countNotPass === null ? 0 : arrays.countNotPass;
		var cntStandardNotPass = arrays.countNotPassDeny === null ? 0 : arrays.countNotPassDeny;
		var cntPass = arrays.countPass === null ? 0 : arrays.countPass;
		var sumsTotal = arrays.total === null ? 0 : arrays.total;
		var actAmount = arrays.actAmount === null ? 0 : arrays.actAmount;
		//$('#cntAllpid').html(parseInt(cntAllPerson));
		//$('#personPass').html(parseInt(cntPass));
		//$('#personAppeal').html(parseInt(cntPersonAppeal));
		//$('#personNotPass').html(parseInt(cntPersonNotPass));
		//$('#standardNotPass').html(parseInt(cntStandardNotPass));
		//$('#sumsTotal').html(currency2Digit(sumsTotal));
		//$('#sumsNotPass').html('0.00');
		//$('#sumsNotPassC').html('0.00');
		//$('#sumsActAmount').html(currency2Digit(actAmount));
		//$('#zone').html(arrays.zone.zoneName);
		//$('#province').html(arrays.province.provinceName);
		var hcode = arrays.hospital.hospitalCode;
		var len = hcode.length;
		hcode = hcode.substring(len-5, len);
		//$('#hospital').html(hcode + ' - ' + arrays.hospital.hospitalName);
		//$('#fromDate').html(toDatepickerValue(arrays.fromDateStr));
		//$('#toDate').html(toDatepickerValue(arrays.toDateStr));
		arrays = arrays.repDataBeans;
		if(arrays !== null && arrays.length > 0){
			$('#detailData').show();
			for(var i in arrays){
				var obj = arrays[i];
				actAmount += obj.compensation;
				sumsTotal += obj.discharge;
				hospitalCode = obj.hospitalCode;
				
				var codeDWHC = nullToEmpty(obj.codeDWHC);
				var codeDWINST = nullToEmpty(obj.codeDWINST);
				var codeDWAE = nullToEmpty(obj.codeDWAE);
				var codeDWIP = nullToEmpty(obj.codeDWIP);
				var codeDWDMIS = nullToEmpty(obj.codeDWDMIS);
				var sumsHC = obj.sumsHC;
				var sumsAE = obj.sumsAE;
				var sumsINST = obj.sumsINST;
				var sumsIP = obj.sumsIP;
				var sumsDMIS = obj.sumsDMIS;
				var sumsDRUG = obj.sumsDRUG;
				
				var codeDWIPCSLG = nullToEmpty(obj.codeDWIPCSLG);
				var codeDWOPCSLG = nullToEmpty(obj.codeDWOPCSLG);
				var codePACSLG = nullToEmpty(obj.codePACSLG);
				var codeINSTCSLG = nullToEmpty(obj.codeINSTCSLG);
				var codeOTCSLG = nullToEmpty(obj.codeOTCSLG);
				var sumsIPCS = obj.sumsIPCS;
				var sumsOPCS = obj.sumsOPCS;
				var sumsPACS = obj.sumsPACS;
				var sumsINSTCS = obj.sumsINSTCS;
				var sumsOTCS = obj.sumsOTCS;
				var sumsDRUGCS = obj.sumsDRUGCS;
				
				var status = 'ผ่าน';
				var clazz = '';
				var clazzTD = '';
				
				if(obj.status === 'A'){
					status = 'อุทธรณ์';
				}else if(obj.status === 'ND'){
					var statusDeny = '';
					
					if(codeDWHC !== '' && codeDWHC !== 'C' && codeDWHC !== 'N'){
						statusDeny += codeDWHC;
					}
					if(codeDWINST !== '' && codeDWINST !== 'C' && codeDWINST !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWINST;
					}
					if(codeDWAE !== '' && codeDWAE !== 'C' && codeDWAE !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWAE;
					}
					if(codeDWIP !== '' && codeDWIP !== 'C' && codeDWIP !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWIP;
					}
					if(codeDWDMIS !== '' && codeDWDMIS !== 'C' && codeDWDMIS !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWDMIS;
					}
					if(codeDWIPCSLG !== '' && codeDWIPCSLG !== 'C' && codeDWIPCSLG !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWIPCSLG;
					}
					if(codeDWOPCSLG !== '' && codeDWOPCSLG !== 'C' && codeDWOPCSLG !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWOPCSLG;
					}
					if(codePACSLG !== '' && codePACSLG !== 'C' && codePACSLG !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codePACSLG;
					}
					if(codeINSTCSLG !== '' && codeINSTCSLG !== 'C' && codeINSTCSLG !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeINSTCSLG;
					}
					if(codeOTCSLG !== '' && codeOTCSLG !== 'C' && codeOTCSLG !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeOTCSLG;
					}
					
					status = 'ไม่เข้าเกณฑ์<br>(' + statusDeny + ')';
				}else if(obj.status === 'N'){
					var statusDeny = '';
					var tmps = obj.codeId.split(",");
					for(var j=0; j<tmps.length; j++){
						if(j === 0){
							statusDeny += 'C' + tmps[j];
						}else{
							statusDeny += ', C' + tmps[j];
						}
					}
					status = 'ไม่ผ่าน<br>(' + statusDeny + ')';
				}
				
				if(obj.orf === 'Y'){
					status += '<br>(ORF)*';
					if('${SESSION_SUMMARY.pageDetailsData.status}' === 'transfer'){
						$("#orfTransfer").html("*หมายเหตุ ORF=เบิกจ่ายจากต้นสังกัด");
					}else{
						$("#orf").html("*หมายเหตุ ORF=เบิกจ่ายจากต้นสังกัด");
					}
				}
				
				var totalDisCom = obj.discharge - obj.compensation;
				var clazzDisCom = '';
				if(totalDisCom < 0){
					clazzDisCom = 'required';
				}
				
				tb += '<tr class="' + clazz + '" id="' + obj.pid + '" title="' + obj.pid + ' ' + obj.fullname + '">';
				tb += '<td width="40px">' + nullToEmpty(obj.id) + '</td>';
				tb += '<td width="100px">' + nullToEmpty(obj.tranId) + '&nbsp;</td>';
				tb += '<td width="100px">' + nullToEmpty(obj.eclaimNo) + '&nbsp;</td>';
				tb += '<td width="70px">' + nullToEmpty(obj.hn) + '&nbsp;</td>';
				tb += '<td width="70px">' + nullToEmpty(obj.an) + '&nbsp;</td>';
				tb += '<td width="95px">' + nullToEmpty(obj.pid) + '</td>';
				tb += '<td width="50px">' + nullToEmpty(obj.personType) + '</td>';
				tb += '<td width="180px" align="left">&nbsp;' + nullToEmpty(obj.fullname) + '</td>';
				tb += '<td width="110px">' + nullToEmpty(obj.admidDate) + '&nbsp;' + nullToEmpty(obj.admidTime) + '</td>';
				tb += '<td width="110px">' + nullToEmpty(obj.dischargeDate) + '&nbsp;' + nullToEmpty(obj.dischargeTime) + '</td>';
				tb += '<td width="70px">' + nullToEmpty(obj.salaryPercent) + '</td>';						
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.salaryAmount)) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.discharge)) + '&nbsp;</td>';
				tb += '<td width="60px">' + nullToEmpty(status) + '</td>';								
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.chargeRule)) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.compensation)) + '&nbsp;</td>';									
				tb += '<td width="100px" align="right" class="' + clazzDisCom + '">' + nullToEmpty(currency2Digit(totalDisCom)) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.orfHMain)) + '&nbsp;</td>';			
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.orfNHSO)) + '&nbsp;</td>';			
				
				if(codeDWHC === 'C'){
					if(sumsHC !== null && sumsHC !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsHC) + '">' + currency2Digit(sumsHC) + '&nbsp;</td>';
						totalSumHC += sumsHC;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWHC === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWHC !== ''){
					tb += '<td width="100px">' + codeDWHC + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}		
				if(codeDWAE === 'C'){
					if(sumsAE !== null && sumsAE !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsAE) + '">' + currency2Digit(sumsAE) + '&nbsp;</td>';
						totalSumAE += sumsAE;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWAE === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWAE !== ''){
					tb += '<td width="100px">' + codeDWAE + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
				
				if(codeDWINST === 'C'){
					if(sumsINST !== null && sumsINST !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsINST) + '">' + currency2Digit(sumsINST) + '&nbsp;</td>';
						totalSumINST += sumsINST;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWINST === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWINST !== ''){
					tb += '<td width="100px">' + codeDWINST + '&nbsp;</td>';
				}else{
					if(codeINSTCSLG === 'C'){
						if(sumsINSTCS !== null && sumsINSTCS !== 0){
							tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsINSTCS) + '">' + currency2Digit(sumsINSTCS) + '&nbsp;</td>';
							totalSumINST += sumsINSTCS;
						}else{
							tb += '<td width="100px">&nbsp;</td>';
						}
					}else if(codeINSTCSLG === 'N'){
						tb += '<td width="100px">&nbsp;</td>';
					}else{
						tb += '<td width="100px">' + codeINSTCSLG + '&nbsp;</td>';
					}
				}
				
				if(codeDWIP === 'C'){
					if(sumsIP !== null && sumsIP !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsIP) + '">' + currency2Digit(sumsIP) + '&nbsp;</td>';
						totalSumIP += sumsIP;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWIP === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWIP !== ''){
					tb += '<td width="100px">' + codeDWIP + '&nbsp;</td>';
				}else{
					if(codeDWIPCSLG === 'C'){
						if(sumsIPCS !== null && sumsIPCS !== 0){
							tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsIPCS) + '">' + currency2Digit(sumsIPCS) + '&nbsp;</td>';
							totalSumIP += sumsIPCS;
						}else{
							tb += '<td width="100px">&nbsp;</td>';
						}
					}else if(codeDWIPCSLG === 'N'){
						tb += '<td width="100px">&nbsp;</td>';
					}else{
						tb += '<td width="100px">' + codeDWIPCSLG + '&nbsp;</td>';
					}
				}
				if(codeDWDMIS === 'C'){
					if(sumsDMIS !== null && sumsDMIS !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsDMIS) + '">' + currency2Digit(sumsDMIS) + '&nbsp;</td>';
						totalSumDMIS += sumsDMIS;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWDMIS === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWDMIS !== ''){
					tb += '<td width="100px">' + codeDWDMIS + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
					
				if(codeDWOPCSLG === 'C'){
					if(sumsOPCS !== null && sumsOPCS !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsOPCS) + '">' + currency2Digit(sumsOPCS) + '&nbsp;</td>';
						totalSumOP += sumsOPCS;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWOPCSLG === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWOPCSLG !== ''){
					tb += '<td width="100px">' + codeDWOPCSLG + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
				
				if(codePACSLG === 'C'){
					if(sumsPACS !== null && sumsPACS !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsPACS) + '">' + currency2Digit(sumsPACS) + '&nbsp;</td>';
						totalSumPA += sumsPACS;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codePACSLG === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codePACSLG !== ''){
					tb += '<td width="100px">' + codePACSLG + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
				
				if(sumsDRUG !== null && sumsDRUG !== 0){
					tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsDRUG) + '">' + currency2Digit(sumsDRUG) + '&nbsp;</td>';
					totalSumDRUG += sumsDRUG;
				}else if(sumsDRUGCS !== null && sumsDRUGCS !== 0){
					tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsDRUGCS) + '">' + currency2Digit(sumsDRUGCS) + '&nbsp;</td>';
					totalSumDRUG += sumsDRUGCS;
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
				
				if(codeOTCSLG === 'C'){
					if(sumsOTCS !== null && sumsOTCS !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsOTCS) + '">' + currency2Digit(sumsOTCS) + '&nbsp;</td>';
						totalSumOT += sumsOTCS;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeOTCSLG === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeOTCSLG !== ''){
					tb += '<td width="100px">' + codeOTCSLG + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
				
				if(obj.status !== 'A'){
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff; color: blue" align="right" class="hidden-table">&nbsp;ไม่มีอุทธรณ์</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-left: 1px solid #ffffff; color: blue" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff; color: blue" align="right" class="hidden-table">&nbsp;ไม่มีอุทธรณ์</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					
					tb += '<td style="color: blue" width="100px" class="hidden-table">&nbsp;</td>';
					tb += '<td style="color: blue" width="100px" class="hidden-table">&nbsp;</td>';
				}else{
					var oldCodeDWHC = nullToEmpty(obj.oldCodeDWHC);
					var oldCodeDWINST = nullToEmpty(obj.oldCodeDWINST);
					var oldCodeDWAE = nullToEmpty(obj.oldCodeDWAE);
					var oldCodeDWIP = nullToEmpty(obj.oldCodeDWIP);
					var oldCodeDWDMIS = nullToEmpty(obj.oldCodeDWDMIS);
					var oldSumsHC = obj.oldSumsHC;
					var oldSumsAE = obj.oldSumsAE;
					var oldSumsINST = obj.oldSumsINST;
					var oldSumsIP = obj.oldSumsIP;
					var oldSumsDMIS = obj.oldSumsDMIS;
					var oldSumsDRUG = obj.oldSumsDRUG;
					
					var oldCodeDWIPCSLG = nullToEmpty(obj.oldCodeDWIPCSLG);
					var oldCodeDWOPCSLG = nullToEmpty(obj.oldCodeDWOPCSLG);
					var oldCodeDWPACSLG = nullToEmpty(obj.oldCodeDWPACSLG);
					var oldCodeDWINSTCSLG = nullToEmpty(obj.oldCodeDWINSTCSLG);
					var oldCodeDWOTCSLG = nullToEmpty(obj.oldCodeDWOTCSLG);
					var oldSumsIPCS = obj.sumsIPCS;
					var oldSumsOPCS = obj.sumsOPCS;
					var oldSumsPACS = obj.sumsPACS;
					var oldSumsINSTCS = obj.sumsINSTCS;
					var oldSumsOTCS = obj.sumsOTCS;
					var oldSumsDRUGCS = obj.sumsDRUGCS;
				
					tb += '<td width="100px" style="text-align:right" class="hidden-table">' + nullToEmpty(currency2Digit(obj.oldDischarge)) + '&nbsp;</td>';
					totalOldTotal += obj.oldDischarge;
					
					if(oldCodeDWHC === 'C'){
						if(oldSumsHC !== null && oldSumsHC !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsHC) + '">' + currency2Digit(oldSumsHC) + '&nbsp;</td>';
							totalOldSumHC += oldSumsHC;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWHC === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWHC !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWHC + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldCodeDWAE === 'C'){
						if(oldSumsAE !== null && oldSumsAE !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsAE) + '">' + currency2Digit(oldSumsAE) + '&nbsp;</td>';
							totalOldSumAE += oldSumsAE;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWAE === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWAE !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWAE + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldCodeDWINST === 'C'){
						if(oldSumsINST !== null && oldSumsINST !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsINST) + '">' + currency2Digit(oldSumsINST) + '&nbsp;</td>';
							totalOldSumINST += oldSumsINST;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWINST === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWINST !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWINST + '&nbsp;</td>';
					}else{
						if(oldCodeDWINSTCSLG === 'C'){
							if(oldSumsINSTCS !== null && oldSumsINSTCS !== 0){
								tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsINSTCS) + '">' + currency2Digit(oldSumsINSTCS) + '&nbsp;</td>';
								totalOldSumINST += oldSumsINSTCS;
							}else{
								tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
							}
						}else if(oldCodeDWINSTCSLG === 'N'){
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}else{
							tb += '<td width="100px"  class="hidden-table">' + oldCodeDWINSTCSLG + '&nbsp;</td>';
						}
					}
					
					if(oldCodeDWIP === 'C'){
						if(oldSumsIP !== null && oldSumsIP !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsIP) + '">' + currency2Digit(oldSumsIP) + '&nbsp;</td>';
							totalOldSumIP += oldSumsIP;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWIP === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWIP !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWIP + '&nbsp;</td>';
					}else{
						if(oldCodeDWIPCSLG === 'C'){
							if(oldSumsIPCS !== null && oldSumsIPCS !== 0){
								tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsIPCS) + '">' + currency2Digit(oldSumsIPCS) + '&nbsp;</td>';
								totalOldSumIP += oldSumsIPCS;
							}else{
								tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
							}
						}else if(oldCodeDWIPCSLG === 'N'){
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}else{
							tb += '<td width="100px"  class="hidden-table">' + oldCodeDWIPCSLG + '&nbsp;</td>';
						}
					}
					
					if(oldCodeDWDMIS === 'C'){
						if(oldSumsDMIS !== null && oldSumsDMIS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsDMIS) + '">' + currency2Digit(oldSumsDMIS) + '&nbsp;</td>';
							totalOldSumDMIS += oldSumsDMIS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWDMIS === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWDMIS !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWDMIS + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldCodeDWOPCSLG === 'C'){
						if(oldSumsOPCS !== null && oldSumsOPCS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsOPCS) + '">' + currency2Digit(oldSumsOPCS) + '&nbsp;</td>';
							totalOldSumOP += oldSumsOPCS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWOPCSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWOPCSLG !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWOPCSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldCodeDWPACSLG === 'C'){
						if(oldSumsPACS !== null && oldSumsPACS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsPACS) + '">' + currency2Digit(oldSumsPACS) + '&nbsp;</td>';
							totalOldSumPA += oldSumsPACS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWPACSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWPACSLG !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWPACSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldSumsDRUG !== null && oldSumsDRUG !== 0){
						tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsDRUG) + '">' + currency2Digit(oldSumsDRUG) + '&nbsp;</td>';
						totalOldSumDRUG += oldSumsDRUG;
					}else if(oldSumsDRUGCS !== null && oldSumsDRUGCS !== 0){
						tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsDRUGCS) + '">' + currency2Digit(oldSumsDRUGCS) + '&nbsp;</td>';
						totalOldSumDRUG += oldSumsDRUGCS;
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldCodeDWOTCSLG === 'C'){
						if(oldSumsOTCS !== null && oldSumsOTCS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsOTCS) + '">' + currency2Digit(oldSumsOTCS) + '&nbsp;</td>';
							totalOldSumOT += oldSumsOTCS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWOTCSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWOTCSLG !== ''){
						tb += '<td width="100px"  class="hidden-table"">' + oldCodeDWOTCSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					tb += '<td width="100px" style="text-align:right"  class="hidden-table">' + nullToEmpty(currency2Digit(obj.oldCompensation)) + '&nbsp;</td>';
					totalOldAmount += obj.oldCompensation;	
					
					tb += '<td width="100px" style="text-align:right"  class="hidden-table">' + nullToEmpty(currency2Digit(obj.discharge)) + '&nbsp;</td>';	
					totalNewDischarge += obj.discharge;				
					if(codeDWHC === 'C'){
						if(sumsHC !== null && sumsHC !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsHC) + '">' + currency2Digit(sumsHC) + '&nbsp;</td>';
							totalNewSumHC += sumsHC;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWHC === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWHC !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWHC + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
								
					if(codeDWAE === 'C'){
						if(sumsAE !== null && sumsAE !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsAE) + '">' + currency2Digit(sumsAE) + '&nbsp;</td>';
							totalNewSumAE += sumsAE;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWAE === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWAE !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWAE + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(codeDWINST === 'C'){
						if(sumsINST !== null && sumsINST !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsINST) + '">' + currency2Digit(sumsINST) + '&nbsp;</td>';
							totalNewSumINST += sumsINST;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWINST === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWINST !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWINST + '&nbsp;</td>';
					}else{
						if(codeINSTCSLG === 'C'){
							if(sumsINSTCS !== null && sumsINSTCS !== 0){
								tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsINSTCS) + '">' + currency2Digit(sumsINSTCS) + '&nbsp;</td>';
								totalNewSumINST += sumsINSTCS;
							}else{
								tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
							}
						}else if(codeINSTCSLG === 'N'){
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}else{
							tb += '<td width="100px"  class="hidden-table">' + codeINSTCSLG + '&nbsp;</td>';
						}
					}
					
					if(codeDWIP === 'C'){
						if(sumsIP !== null && sumsIP !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsIP) + '">' + currency2Digit(sumsIP) + '&nbsp;</td>';
							totalNewSumIP += sumsIP;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWIP === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWIP !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWIP + '&nbsp;</td>';
					}else{
						if(codeDWIPCSLG === 'C'){
							if(sumsIPCS !== null && sumsIPCS !== 0){
								tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsIPCS) + '">' + currency2Digit(sumsIPCS) + '&nbsp;</td>';
								totalNewSumIP += sumsIPCS;
							}else{
								tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
							}
						}else if(codeDWIPCSLG === 'N'){
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}else{
							tb += '<td width="100px"  class="hidden-table">' + codeDWIPCSLG + '&nbsp;</td>';
						}
					}
					
					if(codeDWDMIS === 'C'){
						if(sumsDMIS !== null && sumsDMIS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsDMIS) + '">' + currency2Digit(sumsDMIS) + '&nbsp;</td>';
							totalNewSumDMIS += sumsDMIS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWDMIS === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWDMIS !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWDMIS + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(codeDWOPCSLG === 'C'){
						if(sumsOPCS !== null && sumsOPCS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsOPCS) + '">' + currency2Digit(sumsOPCS) + '&nbsp;</td>';
							totalNewSumOP += sumsOPCS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWOPCSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWOPCSLG !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWOPCSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
						
					if(codePACSLG === 'C'){
						if(sumsPACS !== null && sumsPACS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsPACS) + '">' + currency2Digit(sumsPACS) + '&nbsp;</td>';
							totalNewSumPA += sumsPACS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codePACSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codePACSLG !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codePACSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(sumsDRUG !== null && sumsDRUG !== 0){
						tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsDRUG) + '">' + currency2Digit(sumsDRUG) + '&nbsp;</td>';
						totalNewSumDRUG += sumsDRUG;
					}else if(sumsDRUGCS !== null && sumsDRUGCS !== 0){
						tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsDRUGCS) + '">' + currency2Digit(sumsDRUGCS) + '&nbsp;</td>';
						totalNewSumDRUG += sumsDRUG;
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(codeOTCSLG === 'C'){
						if(sumsOTCS !== null && sumsOTCS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsOTCS) + '">' + currency2Digit(sumsOTCS) + '&nbsp;</td>';
							totalNewSumOT += sumsOTCS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeOTCSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeOTCSLG !== ''){
						tb += '<td width="100px"  class="hidden-table"">' + codeOTCSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}				
					tb += '<td width="100px" style="text-align:right"  class="hidden-table">' + nullToEmpty(currency2Digit(obj.compensation)) + '&nbsp;</td>';
					totalNewCompensation += obj.compensation;
					
					var amnt = obj.oldCompensation - obj.compensation;
					var pay = 0;
					var payReturn = 0;
					if(amnt < 0){
						pay = obj.compensation - obj.oldCompensation;
						payReturn = 0;
					}else{
						pay = 0;
						payReturn = amnt;
					}
					
					tb += '<td width="100px" style="text-align:right" class="hidden-table">' + currency2Digit(pay) + '&nbsp;</td>';
					tb += '<td width="100px" style="text-align:right" class="hidden-table">' + currency2Digit(payReturn) + '&nbsp;</td>';
					
					countStatusA += 1;
					
					amnt = obj.oldCompensation - obj.compensation;
					pay = 0;
					payReturn = 0;
					if(amnt < 0){
						pay = obj.compensation - obj.oldCompensation;
					}else{
						payReturn = amnt;
					}
					totalPay += pay;
					totalReturn += payReturn;
				}
				tb += '</tr>';
				
				totalSalaryAmount += obj.salaryAmount;
				totalDischarge += obj.discharge;
				totalChargeRule += obj.chargeRule;
				totalCompensation += obj.compensation;
				
				totalOrfHMain += obj.orfHMain;
				totalOrfNHSO += obj.orfNHSO;
			}
			
			var totalDisComTotal = totalDischarge - totalCompensation;
			var clazzDisComTotal = '';
			if(totalDisComTotal < 0){
				clazzDisComTotal = 'required';
			}
			
			if(end >= cntAll){
				tb += '<tr style="background-color: rgb(224,224,224);">';
				tb += '<td colspan="10" style="text-align: center"><strong>รวม</strong>&nbsp;</td>';
				tb += '<td width="70px"></td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalSalaryAmount) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalDischarge) + '&nbsp;</td>';
				tb += '<td width="60px"></td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalChargeRule) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalCompensation) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="' + clazzDisComTotal + '">' + currency2Digit(totalDisComTotal) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalOrfHMain) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalOrfNHSO) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalSumHC) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalSumAE) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalSumINST) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalSumIP) + '&nbsp;</td>';										
				tb += '<td width="100px" align="right">' + currency2Digit(totalSumDMIS) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalSumOP) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalSumPA) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalSumDRUG) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + currency2Digit(totalSumOT) + '&nbsp;</td>';
	
				if(countStatusA > 0){
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldTotal) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumHC) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumAE) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumINST) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumIP) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumDMIS) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumOP) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumPA) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumDRUG) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumOT) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldAmount) + '&nbsp;</td>';
					
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewDischarge) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumHC) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumAE) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumINST) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumIP) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumDMIS) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumOP) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumPA) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumDRUG) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumOT) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewCompensation) + '&nbsp;</td>';
					
					var tt = totalPay - totalReturn;
					if(tt < 0){
						totalReturn = totalReturn - totalPay;
						totalPay = 0;
					}else{
						totalReturn = 0;
						totalPay = tt;
					}
					
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalPay) + '&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalReturn) + '&nbsp;</td>';
				}else{
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				}
				tb += '</tr>';
			}
		}else{
			$('#cntAllpid').html(0);
			$('#personPass').html(0);
			$('#personAppeal').html(0);
			$('#personNotPass').html(0);
			$('#standardNotPass').html(0);
			$('#sumsTotal').html("0.00");
			$('#sumsActAmount').html("0.00");
			tb = '<tr><td colspan="26" class="required">ไม่มีข้อมูล</td></tr>';
		}
		
		$("#tbBodyData tbody").html(tb);
		$('.hidden-table').hide();
	}
	
	function clearData(){
		loadingScroll = DEFAULT_SCROLL;
		start = 0;
		end = 1000;
		cntAll = 0;
		totalSalaryAmount = 0;
		totalDischarge = 0;
		totalChargeRule = 0;
		totalCompensation = 0;
		
		totalSumHC = 0;
		totalSumAE = 0;
		totalSumINST = 0;
		totalSumIP = 0;
		totalSumDMIS = 0;
		totalSumOP = 0;
		totalSumPA = 0;
		totalSumOT = 0;
		totalSumDRUG = 0;
		
		totalOldTotal = 0;
		totalOldSumHC = 0;
		totalOldSumAE = 0;
		totalOldSumINST = 0;
		totalOldSumIP = 0;
		totalOldSumDMIS = 0;
		totalOldSumOP = 0;
		totalOldSumPA = 0;
		totalOldSumOT = 0;
		totalOldSumDRUG = 0;
		totalOldAmount = 0;
		
		totalNewSumHC = 0;
		totalNewSumAE = 0;
		totalNewSumINST = 0;
		totalNewSumIP = 0;
		totalNewSumDMIS = 0;
		totalNewSumOP = 0;
		totalNewSumPA = 0;
		totalNewSumOT = 0;
		totalNewSumDRUG = 0;
		totalNewDischarge = 0;
		totalNewCompensation = 0;
		
		totalPay = 0;
		totalReturn = 0;
		
		countStatusA = 0;
	}
</script>

<style>
.amount {
	color: blue;
	text-align: right;
}

</style>
</head>

<body>
	<!------------------- Header ------------------>
	<div class="panel">
		<jsp:include page="../include/header.jsp" />
	</div>
	<!--------------------------------------------->

	<div class="block-content">
		<div id="content" class="content-data">
			<div class="panel">
				<div class="panel-content text-center">
					<div style="margin-top: 5px; position: relative;">
						<c:choose>
							<c:when test='${USER.userType eq "Hospital"}'>
								หน่วยบริการ&nbsp;<input type="text" class="txtHospitalCode" value="${USER.officeCode} - ${USER.officeName}" style="font-size: 14px;width:230px" disabled/><p>
							</c:when>
							<c:otherwise>
								ค้นหาจาก 
								<select id="searchBy" style="width: 150px;height: 28px;font-size: 14px;">
									<option value="">เลือกหน่วยบริการ</option>
									<option value="hcodeSelect" selected="selected">ระบุรหัสหน่วยบริการ</option>
								</select> &nbsp;
								<div id="searchByHCode" style="margin: 5px 0px 0px -49px;">
									รหัสหน่วยบริการ&nbsp;<input type="text" class="txtHospitalCode"/>&nbsp;
								</div>
								<div id="searchGroupHospital" style="display:none; margin-top: 5px;">
									เขต&nbsp;&nbsp;<select id="cbxZone" style="font-size: 14px;">
										<option value="">------ กรุณาเลือก ------</option>	
									</select>&nbsp;
									จังหวัด&nbsp;<select id="cbxProvince" style="font-size: 14px;">
										<option value="">------ กรุณาเลือก ------</option>	
									</select>&nbsp;
									หน่วยบริการ&nbsp;<select id="cbxHospital">
										<option value="">------ กรุณาเลือก ------</option>	
									</select>
								</div>
							</c:otherwise>
						</c:choose>
						<div style="margin-top: 5px">
						</div>
						<div style="margin-top: 5px;">
							ปีงบประมาณ&nbsp;
							<select id="cbxFiscalYear" class="dropdownlist"  style="width: 120px;"></select>
							<input type="text" id="fromFiscalYear" />
							&nbsp;ถึง&nbsp;<input type="text" id="toFiscalYear" />&nbsp;&nbsp;
							แฟ้มการเบิกกองทุน:&nbsp;<select id="cbxSelectAuthType" class="dropdownlist" style="width: 250px">
								<option value="">ทั้งหมด</option>
								<option value="UC">งบหลักประกันสุขภาพถ้วนหน้า (UC)</option>
								<option value="LGO">องค์การปกครองส่วนท้องถิ่น (LGO)</option>
							</select>
						</div>
						<div style="margin-top: 5px">
							<button id="btnSearch">ค้นหา</button>
						</div>
					</div>
					<div id="detailData">
						<!-- <div>
							<b id="zone"></b>&nbsp;&nbsp;จังหวัด&nbsp;<b id="province"></b>&nbsp;&nbsp;
							หน่วยบริการ&nbsp;<b><span id="hospital"></span>&nbsp;</b>
						</div>
						<div>
							ข้อมูลจากวันที่&nbsp;<b id="fromDate"></b>
							ถึงวันที่&nbsp;<b id="toDate"></b>
						</div>
						<div>
							จำนวนรายทั้งหมด&nbsp;<b id="cntAllpid"></b>&nbsp;ราย&nbsp;ผ่าน
							<font style="font-weight: bold; text-decoration: underline;"
								id="personPass"></font>&nbsp;ราย&nbsp;อุทธรณ์
							<font style="font-weight: bold; text-decoration: underline;"
								id="personAppeal"></font>&nbsp;ราย&nbsp;ไม่ผ่าน
							<font style="font-weight: bold; text-decoration: underline;"
								id="personNotPass"></font>&nbsp;ราย&nbsp;ไม่เข้าเกณฑ์
							<font style="font-weight: bold; text-decoration: underline;"
								id="standardNotPass"></font>&nbsp;ราย
						</div>
						<div>
							ยอดเรียกเก็บ&nbsp;<b id="sumsTotal"></b>&nbsp;บาท&nbsp;
							ไม่ผ่าน&nbsp;<b id="sumsNotPass"></b>&nbsp;บาท&nbsp;&nbsp;
							ไม่เข้าเกณฑ์&nbsp;<b id="sumsNotPassC"></b>&nbsp;บาท&nbsp;&nbsp;
							ชดเชยทั้งสิ้น&nbsp; <b id="sumsActAmount"></b> บาท
						</div>-->
						<div style="float: left; margin: 1px;">
							<img alt="Export to Excel" src="${pageContext.request.contextPath}/images/file_xls.gif"
								class="pointer-cursor" title="Export to Excel" id="exportExcel">
							<span style="color: red; font-size: 14px; margin-left: 10px">
								*หมายเหตุ ORF=เบิกจ่ายจากต้นสังกัด</span>
						</div>
						<div style="float: right; margin: 1px;">
							<button id="show_table"><img width="12px" src="${pageContext.request.contextPath}/images/arrow_right.png" /> แสดงข้อมูลอุทธรณ์</button>
							<button id="hide_table"><img width="12px" src="${pageContext.request.contextPath}/images/arrow_left.png" /> ซ่อนข้อมูลอุทธรณ์</button>
						</div>
					</div>
					<div class="data-table">
						<table width="5720px" cellspacing="0" cellpadding="0"
							id="tbHeaderData" style="padding-right: 17px;">
							<thead id="thead1">
								<tr>
									<td rowspan="3" width="40px">ลำดับ</td>
									<td rowspan="3" width="100px">Tran Id</td>
									<td rowspan="3" width="100px">Eclaim No</td>
									<td rowspan="3" width="70px">HN</td>
									<td rowspan="3" width="70px">AN</td>
									<td rowspan="3" width="95px">PID</td>
									<td rowspan="3" width="50px">OP/IP</td>
									<td rowspan="3" width="180px">ชื่อ-นามสกุล</td>
									<td rowspan="3" width="110px">วันที่เข้ารับการรักษา</td>
									<td rowspan="3" width="110px">วันที่จำหน่าย</td>
									<td rowspan="2" colspan="2">เงินเดือน</td>
									<td rowspan="3" width="100px">เรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="3" width="60px">สถานะ</td>
									<td rowspan="3" width="100px">ค่า พรบ.&nbsp;(บาท)</td>
									<td rowspan="3" width="100px">ชดเชย&nbsp;(บาท)</td>
									<td rowspan="3" width="100px">ส่วนต่างจากการเรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="2" colspan="2">OP&nbsp;REFER(NON&nbsp;HC)</td>
									<td colspan="9" rowspan="1">กองทุน&nbsp;(บาท)</td>
								</tr>
								<tr>
									<td>HC</td>
									<td>AE</td>
									<td>INST</td>
									<td>IP</td>
									<td>DMIS</td>
									<td>OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
								</tr>
								<tr>
									<td width="70px">ร้อยละ(%)</td>
									<td width="100px">จำนวนเงิน(บาท)</td>
									<td width="100px">HMAIN</td>
									<td width="100px">NHSO</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
								</tr>
							</thead>
							<thead id="thead2" style="display:none">
								<tr>
									<td rowspan="4" width="40px">ลำดับ</td>
									<td rowspan="4" width="100px">Tran Id</td>
									<td rowspan="4" width="100px">Eclaim No</td>
									<td rowspan="4" width="70px">HN</td>
									<td rowspan="4" width="70px">AN</td>
									<td rowspan="4" width="95px">PID</td>
									<td rowspan="4" width="50px">OP/IP</td>
									<td rowspan="4" width="180px">ชื่อ-นามสกุล</td>
									<td rowspan="4" width="110px">วันที่เข้ารับการรักษา</td>
									<td rowspan="4" width="110px">วันที่จำหน่าย</td>
									<td rowspan="3" colspan="2">เงินเดือน</td>
									<td rowspan="4" width="100px">เรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="4" width="60px">สถานะ</td>
									<td rowspan="4" width="100px">ค่า พรบ.&nbsp;(บาท)</td>
									<td rowspan="4" width="100px">ชดเชย&nbsp;(บาท)</td>
									<td rowspan="4" width="100px">ส่วนต่างจากการเรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="3" colspan="2">OP&nbsp;REFER(NON&nbsp;HC)</td>
									<td colspan="9" rowspan="2">กองทุน&nbsp;(บาท)</td>
									<td colspan="24">ข้อมูลอุทธรณ์</td>
								</tr>
								<tr>
									<td colspan="11" width="300px">ข้อมูลเดิม</td>
									<td colspan="11" width="300px">ข้อมูลใหม่</td>
									<td colspan="2" width="200px">ชดเชยสุทธิ</td>
								</tr>
								<tr>
									<td>HC</td>
									<td>AE</td>
									<td>INST</td>
									<td>IP</td>
									<td>DMIS</td>
									<td>OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
									<!-- Appeal -->
									<td rowspan="2" width="100px">เรียกเก็บ(บาท)</td>
									<td>HC</td>
									<td>AE</td>
									<td>INST</td>
									<td>IP</td>
									<td>DMIS</td>
									<td>OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
									<td rowspan="2" width="100px">จ่ายชดเชย</td>
									<td rowspan="2" width="100px">เรียกเก็บ(บาท)</td>
									<td>HC</td>
									<td>AE</td>
									<td>INST</td>
									<td>IP</td>
									<td>DMIS</td>
									<td>OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
									<td rowspan="2" width="100px">จ่ายชดเชย</td>
									<td width="100px" rowspan="2">จ่ายเพิ่ม</td>
									<td width="100px" rowspan="2">เรียกคืน</td>
								</tr>
								<tr>
									<td width="70px">ร้อยละ(%)</td>
									<td width="100px">จำนวนเงิน(บาท)</td>
									<td width="100px">HMAIN</td>
									<td width="100px">NHSO</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<!-- Appeal -->
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>

									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
								</tr>
							</thead>
						</table>

						<div style="overflow-y: auto; overflow-x: hidden; position: absolute; height: 390px;"id="tbValueData">
							<table width="5920px" cellspacing="0" cellpadding="0" id="tbBodyData" style="padding-right: 17px;">
								<tbody>
								</tbody>
							</table>
						</div>
					</div>

				</div>
			</div>
		</div>
	</div>


</body>
</html>
